PREFIX = /usr/local

BORGELT = http://fuzzy.cs.uni-magdeburg.de/~borgelt/src

#
# Source directories for each set of tools.
#
SRC = apriori table dtree bayes

#
# Executable that belong to each set of tools.
#
APR = apriori
TBL = dom opc tmerge tsplit tjoin tbal tnorm t1inn xmat uvins
DTR = dti dtp dtx dtr rsx
BYS = bcdb bci bcx corr

all: $(SRC)

#
# Tune installation of each tool.
#
install: $(SRC:%=%.ins)

apriori.ins: apriori/
	for i in $(APR); do install $^src/$$i $(PREFIX)/bin; done

table.ins: table/
	for i in $(TBL); do install $^src/$$i $(PREFIX)/bin; done

dtree.ins: dtree/
	for i in $(DTR); do install $^src/$$i $(PREFIX)/bin; done

bayes.ins: bayes/
	for i in $(BYS); do install $^src/$$i $(PREFIX)/bin; done


#
# Build each tool: they all share the same structure for building.
# 
%: %.tar.gz
	tar zxvf $^
	(cd $*/src; make)

realclean:
	rm -rf $(SRC) util math

#
# To even automate the whole process including downloading:
#

#%.tar.gz:
#	wget --quiet $(BORGELT)/$*.tar.gz
